Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to use file descriptors with virtio-serial and virtio-net #26

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

cfergeau
Copy link
Collaborator

@cfergeau cfergeau commented Apr 4, 2023

Passing a file descriptor to virtio-serial allows to implement an interactive console.
Passing a file descriptor to virtio-net makes it possible to forward the network traffic from guest network interface to a host socket without going copying the data through virtio-vsock or such.

This should allow for more efficient user-space networking, it's no more
needed to create a tap interface in the guest and forward the network
traffic over virtio-vsock.

This adds a 'fd' parameter to '--device virtio-net' which expects a file
descriptor number. It must correspond to a connected datagram socket.
This allows to redirect the VM network traffic to a different process
from the command line:
term1> nc --listen --unix /tmp/unix.sock
term2> vfkit --device virtio-net unixSocketPath=/tmp/unix.sock

This complements the '--device virtio-net fd=x' support which was added
in the previous commit, it might be easier to directly specify a Unix
socket to use.
This makes it possible to have an interactive serial console.
This returns a standard golang exec.Command, and takes care of setting
ExtraFiles as needed, ... Longer term we can add more APIs to start the
vfkit process, monitor it, ...
@anjannath anjannath merged commit 223460b into crc-org:main Apr 19, 2023
@cfergeau cfergeau deleted the file-handles branch July 26, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants